test(agent-memory): isolate integration tests with unique agent ID and teardown cleanup - #277
Open
cassiofariasmachado wants to merge 2 commits into
Open
test(agent-memory): isolate integration tests with unique agent ID and teardown cleanup#277cassiofariasmachado wants to merge 2 commits into
cassiofariasmachado wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Integration tests for the Agent Memory module were accumulating records in the shared backend on every run because all tests used the hardcoded
agent_id"test-agent". Over time this caused the vector index to grow (observed at 37,873 records), making the semantic search endpoint time out.This PR fixes the issue by:
run_agent_idsession-scoped fixture that generates a uniquetest-agent-<8hex>ID per run, so each run's data is fully isolated._delete_all_memorieshelper that paginates through all records for the run'sagent_idand deletes them in teardown, keeping the backend clean after every run."test-agent"/"test-user"to read fromcontext["agent_id"]andcontext["invoker_id"]instead.check_memory_agent_idandcheck_memory_invoker_idassertion steps to compare against the runtime values rather than the literal strings from the feature file.Related Issue
N/A
Type of Change
How to Test
uv run pytest tests/agent_memory/integration -vtest_search_memoriestest_search_memoriesshould remain fast because the previous run's data was cleaned upChecklist
Breaking Changes
None.
Additional Notes
The feature file (
agentmemory.feature) is unchanged — it still references"test-agent"and"test-user"as readable scenario labels. The step implementations now ignore those parsed values in favour of the runtime-isolated IDs fromcontext.